<?php

namespace app\comm\service;
use think\Db;
use think\Cache;

/**
 *
 * 城市
 */
class CityService{

	/**
	 * 获取到城市列表
	 */
	public function getCityList(){
		$citylist = Db::table("ys_city")->select();
		return $citylist;
	}

	/**
	 * 缓存 中获取城市列表
	 * @return [type] [description]
	 */
	public function getCityListByCache(){
		$citylist = Cache::get("city_cache");
		if(!$citylist){
			$citylist = $this->getCityList();
			Cache::set("city_cache" , $citylist);
			return $citylist;
		}
		return $citylist;
	}
}
